class ShoppingList:
    def __init__(self,shoppinglist):
        self.shoppinglist=shoppinglist
    def get_shopping_count(self):
        #不return len肯定什么都拿不出来
        return len(self.shoppinglist)
    def get_shopping_price(self):
        #这里错误 price_total一开始是0，叠加变多
        price_total=0
        for price in self.shoppinglist.values():
            price_total+=price
        #return 肯定不能写在for循环里只能算出一次循环然后就不在执行了
        return price_total
# shop1=ShoppingList({"纸巾":8,"矿泉水":2,"拖鞋":15})
# print(shop1.shoppinglist)
# print(shop1.get_shopping_price())
# print(shop1.get_shopping_count())
